//
//  moneyDetailViewController.m
//  忘不了
//
//  Created by rimi on 16/7/12.
//  Copyright © 2016年 handuan. All rights reserved.
//

#import "moneyDetailViewController.h"
#import "SDAutoLayout.h"

@interface moneyDetailViewController ()
@property (nonatomic,strong)UILabel *moneyLabel;
@property (nonatomic,strong)UILabel *dateLabel;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UITextView *detailView;
@property (nonatomic,strong)UILabel *addressLabel;
@property (nonatomic,strong)UILabel *flagLabel;
@end

@implementation moneyDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
                                                         forBarMetrics:UIBarMetricsDefault];//隐藏导航栏返回按钮自带的文字
    self.title = @"开支详情";
    
    UIImageView *backGroudView = [[UIImageView alloc]initWithFrame:self.view.frame];
    backGroudView.image = [UIImage imageNamed:@"s.jpg"];
    [self.view addSubview:backGroudView];
    
    [self initInterface];
    
}

- (void)initInterface {
    NSArray *Arr1 = @[@"日期",@"标题",@"详情",@"地点",@"标签"];
    for (int i=0; i<5; i++) {
        UILabel *label = [[UILabel alloc]init];
        label.text = Arr1[i];
        label.textColor = [UIColor whiteColor];
        label.textAlignment = NSTextAlignmentCenter;
        label.font = [UIFont systemFontOfSize:18];
        label.backgroundColor = [UIColor colorWithRed:0.1647 green:0.1647 blue:0.2314 alpha:1.0];
        label.tag = 1100 + i;
        label.layer.cornerRadius = 15;
        label.layer.masksToBounds = YES;
        [self.view addSubview:label];
        if (i == 3) {
            label.sd_layout
            .widthRatioToView(self.view,0.2)
            .heightIs(self.view.frame.size.width*0.1)
            .leftSpaceToView(self.view,0)
            .topSpaceToView(self.view,64+self.view.frame.size.width*0.1*i+ self.view.frame.size.height * 0.3);
        } else if (i == 4) {
            label.sd_layout
            .widthRatioToView(self.view,0.2)
            .heightIs(self.view.frame.size.width*0.1)
            .leftSpaceToView(self.view,0)
            .topSpaceToView([self.view viewWithTag:1103],self.view.frame.size.width*0.1);
        } else {
            label.sd_layout
            .widthRatioToView(self.view,0.2)
            .heightIs(self.view.frame.size.width*0.1)
            .leftSpaceToView(self.view,0)
            .topSpaceToView(self.view,64+self.view.frame.size.width*0.1*i+40*i);
        }
    }

    _moneyLabel = [[UILabel alloc]init];
    _moneyLabel.textColor = [UIColor colorWithRed:0.8784 green:0.2471 blue:0.2863 alpha:1.0];
    _moneyLabel.textAlignment = NSTextAlignmentCenter;
    _moneyLabel.text = [NSString stringWithFormat:@"¥: %@",self.dataDic[@"money"]];
    _moneyLabel.backgroundColor = [UIColor colorWithRed:0.6925 green:0.6378 blue:0.5472 alpha:1.0];
    _moneyLabel.font = [UIFont systemFontOfSize:35];
    _moneyLabel.numberOfLines = 0;
    [self.view addSubview:_moneyLabel];
    _moneyLabel.sd_layout
    .leftSpaceToView(self.view,0)
    .rightSpaceToView(self.view,0)
    .bottomSpaceToView(self.view,0)
    .heightIs(self.view.frame.size.width*0.2);
    
    _dateLabel = [[UILabel alloc]init];
    _dateLabel.backgroundColor = [UIColor colorWithRed:0.8275 green:0.7961 blue:0.7216 alpha:0.6];
    _dateLabel.textColor = [UIColor brownColor];
    _dateLabel.textAlignment = NSTextAlignmentLeft;
    _dateLabel.text = self.dataDic[@"date"];
    _dateLabel.font = [UIFont systemFontOfSize:20];
    _dateLabel.layer.cornerRadius = 10;
    _dateLabel.layer.masksToBounds = YES;
    [self.view addSubview:_dateLabel];
    _dateLabel.sd_layout
    .leftSpaceToView(self.view,self.view.frame.size.width*0.2+10)
    .rightSpaceToView(self.view,10)
    .topSpaceToView(self.view,65)
    .heightIs(self.view.frame.size.width*0.1);
    
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.textColor = [UIColor brownColor];
    _titleLabel.backgroundColor = [UIColor colorWithRed:0.8275 green:0.7961 blue:0.7216 alpha:0.6];
    _titleLabel.textAlignment = NSTextAlignmentLeft;
    _titleLabel.text = self.dataDic[@"title"];
    _titleLabel.font = [UIFont systemFontOfSize:20];
    _titleLabel.layer.cornerRadius = 10;
    _titleLabel.layer.masksToBounds = YES;
    [self.view addSubview:_titleLabel];
    _titleLabel.sd_layout
    .leftSpaceToView(self.view,self.view.frame.size.width*0.2+10)
    .rightSpaceToView(self.view,10)
    .centerYEqualToView([self.view viewWithTag:1101])
    .heightIs(self.view.frame.size.width*0.1);
    
    _detailView = [[UITextView alloc]init];
    _detailView.backgroundColor = [UIColor colorWithRed:0.8275 green:0.7961 blue:0.7216 alpha:0.6];
    _detailView.textColor = [UIColor brownColor];
    _detailView.textAlignment = NSTextAlignmentLeft;
    _detailView.text = self.dataDic[@"detail"];
    _detailView.font = [UIFont systemFontOfSize:20];
    _detailView.layer.cornerRadius = 10;
    _detailView.layer.masksToBounds = YES;
    _detailView.editable = NO;
    [self.view addSubview:_detailView];
    _detailView.sd_layout
    .leftSpaceToView(self.view,self.view.frame.size.width*0.2+10)
    .rightSpaceToView(self.view,10)
    .topEqualToView([self.view viewWithTag:1102])
    .heightIs(self.view.frame.size.width*0.35);
    
    _addressLabel = [[UILabel alloc]init];
    _addressLabel.backgroundColor = [UIColor colorWithRed:0.8275 green:0.7961 blue:0.7216 alpha:0.6];
    _addressLabel.textColor = [UIColor brownColor];
    _addressLabel.textAlignment = NSTextAlignmentLeft;
    _addressLabel.text = self.dataDic[@"address"];
    _addressLabel.font = [UIFont systemFontOfSize:20];
    _addressLabel.layer.cornerRadius = 10;
    _addressLabel.layer.masksToBounds = YES;
    [self.view addSubview:_addressLabel];
    _addressLabel.sd_layout
    .leftSpaceToView(self.view,self.view.frame.size.width*0.2+10)
    .rightSpaceToView(self.view,10)
    .centerYEqualToView([self.view viewWithTag:1103])
    .heightIs(self.view.frame.size.width*0.1);
    
    _flagLabel = [[UILabel alloc]init];
    _flagLabel.backgroundColor = [UIColor colorWithRed:0.8275 green:0.7961 blue:0.7216 alpha:0.6];
    _flagLabel.textColor = [UIColor brownColor];
    _flagLabel.textAlignment = NSTextAlignmentLeft;
    _flagLabel.text = self.dataDic[@"flag"];
    _flagLabel.font = [UIFont systemFontOfSize:20];
    _flagLabel.layer.cornerRadius = 10;
    _flagLabel.layer.masksToBounds = YES;
    [self.view addSubview:_flagLabel];
    _flagLabel.sd_layout
    .leftSpaceToView(self.view,self.view.frame.size.width*0.2+10)
    .rightSpaceToView(self.view,10)
    .heightIs(self.view.frame.size.width*0.1)
    .centerYEqualToView([self.view viewWithTag:1104]);
    
}




@end
